//
//  HShowQuesCollectionViewCell.m
//  NursingManages
//
//  Created by Zhen Huang on 17/9/22.
//  Copyright © 2017年 huangzhen. All rights reserved.
//

#import "HShowQuesCollectionViewCell.h"
#import "Model_Hr_Question_Item.h"
@implementation HShowQuesCollectionViewCell



- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        
        [self setUpLayout];
    }
    return self;
}


- (void)setUpLayout {
    
    self.quesButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.quesButton.frame = CGRectMake(0, 0, 50, 50);
    self.quesButton.layer.masksToBounds = YES;
    self.quesButton.layer.cornerRadius = 25;
    [self.quesButton.layer setBorderColor:[UIColor lightGrayColor].CGColor];
    [self.quesButton.layer setBorderWidth:0.5];
    [self.quesButton.layer setMasksToBounds:YES];
    [self.quesButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.contentView addSubview:self.quesButton];
    
}

- (void)configureWithModel:(Model_Hr_ExamAnswer *)model type:(NSInteger)type
{
    
    if (type == 1) {
        
        if (model.answerState == 1) {
            
        }else if (model.answerState == 2 ) {
            
            self.quesButton.backgroundColor = RGB(216,247,217);
            
            [self.quesButton.layer setBorderColor:RGB(69,185,124).CGColor];
            
            [self.quesButton setTitleColor:RGB(69, 185, 124) forState:UIControlStateNormal];
            
        }else {
            self.quesButton.backgroundColor = RGB(255,220,220);
            
            [self.quesButton.layer setBorderColor:RGB(215,19,69).CGColor];
            
            [self.quesButton setTitleColor:RGB(215,19,69) forState:UIControlStateNormal];
            
        }

    }else {
        
        if (model.answerState == 1) {
            
        }else {
            
            self.quesButton.backgroundColor = RGB(216,247,217);
            
            [self.quesButton.layer setBorderColor:RGB(69,185,124).CGColor];
            
            [self.quesButton setTitleColor:RGB(69, 185, 124) forState:UIControlStateNormal];

        }
    }
    
}
@end
